<template>
    <div>
        <div class="goback" @click="action">
            <slot></slot>
        </div>
        <div class="header-title">{{title}}</div>
    </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
    props: {
        title: {
            type: String,
            default: ''
        }
    },
    emits: ['action'],
    setup (props, { emit }) {
        console.log('header-title')
        const action = () => {
            emit('action')
        }
        return {
            action
        }
    }
})
</script>

<style lang="scss">
.goback {
    position: absolute;
    top: 0;
    left: 6px;
    z-index: 20;
    transform: translateZ(10px);
    i {
        display: block;
        padding: 9px 10px;
        font-size: 22px;
        color: #ffcd32;
    }
}
.header-title {
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    text-align: center;
    height: 40px;
    line-height: 40px;
    font-size: 16px;
    color: rgba(255, 255, 255, .7);
    z-index: 20;
    transform: translateZ(10px);
}
</style>
